import request from '@/utils/request'

// 查询销售合同列表
export function listContract(query) {
  return request({
    url: '/sale/contract/list',
    method: 'get',
    params: query
  })
}

// 查询销售合同详细
export function getContract(contractId) {
  return request({
    url: '/sale/contract/' + contractId,
    method: 'get'
  })
}

// 新增销售合同
export function addContract(data) {
  return request({
    url: '/sale/contract',
    method: 'post',
    data: data
  })
}

// 修改销售合同
export function updateContract(data) {
  return request({
    url: '/sale/contract',
    method: 'put',
    data: data
  })
}

// 删除销售合同
export function delContract(contractId) {
  return request({
    url: '/sale/contract/' + contractId,
    method: 'delete'
  })
}

// 提交销售合同
export function commitContract(data) {
  return request({
    url: '/sale/contract/commit',
    method: 'post',
    data: data
  })
}

// 撤回销售合同
export function recallContract(data) {
  return request({
    url: '/sale/contract/recall',
    method: 'post',
    data: data
  })
}

// 审批销售合同
export function approveContract(data) {
  return request({
    url: '/sale/contract/approve',
    method: 'post',
    data: data
  })
}

// 弃审销售合同
export function unapproveContract(data) {
  return request({
    url: '/sale/contract/unapprove',
    method: 'post',
    data: data
  })
}
